<template>
	<view class="container">
		<uni-section title="食物列表详情" type="line">
			<uni-list>
				<uni-list-item clickable @click="show(item.id)" v-for="(item,index) in comment" :key="item.id"
					:title="item.comment" note=""></uni-list-item>
			</uni-list>
		</uni-section>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				comment: []
			}
		},
		methods: {
			show(id) {
				uni.navigateTo({
					url: '../commentdetail/commentdetail?id=' + id
				});
			}
		},
		onLoad() {
			uni.request({
				url: 'http://localhost:8090/foodapp/comment/list',
				method: 'POST',
				data: {},
				success: res => {
					if (res.data.success) {
						this.comment = res.data.list
						uni.showToast({
							title: '成功',
							icon: 'none'
						});
					} else {
						uni.showToast({
							title: '失败',
							icon: 'none'
						});
					}
				},
				fail: () => {},
				complete: () => {}
			});
		}
	}
</script>

<style>
	.container {
		padding: 20px;
		font-size: 14px;
		line-height: 24px;
	}
</style>
